10.1 Deal with the sample-related data
When analyzing data with the EasyMultiProfiler package, it’s often necessary to re-group samples. Instead of modifying the original data and re-create the MAE object, users can use the $ methods and tidy syntax to address the problem efficiently.
10.1.1 Regroup the samples
🏷️Example:
Firstly, extract the coldata of taxonomy. Then, create a new variable Edu_status from the original Education_Years variable (using this new variable for grouping), and finally add the new variable back into the original MAE object using the $method.
Note:
The primary order in the new coldata and original coldata must be the same exactly.
The primary order in the new coldata and original coldata must be the same exactly.
raw_meta <- MAE|>
EMP_coldata_extract(experiment = 'taxonomy')
new_meta <- raw_meta |>
dplyr::mutate(Edu_status = dplyr::if_else(Education_Years > 15, "High", "Low"))
new_meta <- new_meta[match(raw_meta$primary, new_meta$primary), ]
MAE$Edu_status <- new_meta$Edu_status
10.1.2 Reorder the group
Sometimes, it is necessary to reorder groupings in the plot.
🏷️Example:
MAE$Group <- factor(MAE$Group, levels = c('Group_B','Group_A'))
MAE |>
EMP_assay_extract(experiment='taxonomy') |>
EMP_alpha_analysis() |>
EMP_boxplot(estimate_group='Group',method='t.test')